<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="<%= window.location.href %>">每日电玩城统计</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
    </div>
</header>
<section id="content">
<div class="panel">
    <form class="form-horizontal">
        <div class="form-group">
            <div class="col-md-3">
                <input type="text" style="margin-top: 5px" id="dateFilter" name="dateFilter" class="form-control text-center" value="<%= options.dateRange[0] %> ~ <%= options.dateRange[1] %>">
            </div>
            <div class="col-md-1" style="margin:  2px 10px; width: 100px;">
                <label for="SearchType" class="field select">
                    <select id="searchGameFilter" name="searchGameFilter" data-field="game_filter"  class="field select"
                    style=" margin-top:7px; width: 100px;height:35px" multiple>
                        <option value="lottery" <%= (searched.game_filter || []).includes('lottery') ? 'selected' : '' %>>森林转转乐	</option>
                        <option value="bull" <%= (searched.game_filter || []).includes('bull') ? 'selected' : '' %>>百人牛牛	</option>
                        <option value="kfc" <%= (searched.game_filter || []).includes('kfc') ? 'selected' : '' %>>Slot	</option>
                        <option value="fruit" <%= (searched.game_filter || []).includes('fruit') ? 'selected' : '' %>>水果机	</option>
                    <% _.each(window.METIS_GAME_TYPE, function(v, k){   %>
                        <option value="<%= k %>" <%= (searched.game_filter || []).includes(k) ? 'selected' : '' %>> <%= v %> </option>
                    <% }); %>
                    </select>
                </label>
            </div>
            <div class="col-md-1" style="margin:  2px 10px; width: 100px;">
                <label for="SearchType" class="field select">
                    <select id="ByNewUser" name="SearchType" data-field="bet_type" class="field select"
                    style=" margin-top:7px; width: 100px;height:35px">
                        <option value=0 <%= options.by_new_user == 0 ? 'selected' : '' %>>全部用户</option>
                        <option value=1 <%= options.by_new_user == 1 ? 'selected' : '' %>>新用户</option>
                    </select>
                </label>
            </div>
            <div class="col-md-1" style="margin:  2px 10px; width: 100px;">
                <input type="button" id="search" style="margin-top: 5px" class="btn btn-primary btn-block form-control" value="提交">
            </div>
        </div>
    </form>
</div>

<div class="panel ">
    <table class="table table-striped fs13" id="main-list">
        <thead>
            <tr class="bg-light">
                <th class="sortable" data-field="date">日期</th>
                <th>游戏名称</th>
                <th class="sortable" data-field="user_count">人数</th>
                <th class="sortable" data-field="total_bet">金额</th>
                <th data-field="">中奖金额</th>
                <th class="sortable" data-field="total_profit">抽水金额</th>
                <th class="sortable" data-field="">抽水率</th>
                <% console.log(!options.by_new_user)
                if(options.by_new_user == 0 || options.by_new_user === undefined){ %>
                <th data-field="">原始抽水金额</th>
                <th data-field="">原始抽水率</th>
                <% } %>
                <th class="sortable" data-field="gain_count">盈利人数</th>
                <th class="sortable" data-field="gain_amount">盈利金额</th>
                <th class="sortable" data-field="lose_count">亏损人数</th>
                <th class="sortable" data-field="lose_amount">亏损金额</th>
                <th class="sortable" data-field="banker_person">上庄人数</th>
                <th class="sortable" data-field="banker_count">上庄次数</th>
                <th class="sortable" data-field="banker_bet">上庄参与</th>
                <th class="sortable" data-field="banker_gain">庄家盈利</th>
                <th class="sortable" data-field="banker_system_gain">系统抽成</th>
            </tr>
        </thead>
        <tbody class="admin-form">
            <% _.each(items, function(item){
                profit = parseFloat(((item.total_profit/item.total_bet))*100).toFixed(1);
            %>
                <tr>
                    <td><%= item.date%></td>
                    <td><%= GAME_TYPE_NAME[item.type] || item.type%></td>
                    <td><%= item.user_count %></td>
                    <td><%= item.total_bet.toFixed(2) %></td>
                    <td><%= (item.total_bet - item.total_profit).toFixed(2) %></td>
                    <td><%= (item.total_profit ||0).toFixed(2)%></td>
                    <td><%= isNaN(profit)? 0:profit%>%</td>
                    <% if(options.by_new_user == 0 || options.by_new_user === undefined){ %>
                    <td><%= isNaN(item.system_original_gain) ? '-': item.system_original_gain.toFixed(2)%></td>
                    <td><%= ((item.system_original_gain / item.sys_bet_amount * 100) || 0).toFixed(2) %>%</td>
                    <% } %>
                    <td><%= isNaN(item.gain_count) ? '-': item.gain_count %></td>
                    <td><%= isNaN(item.gain_amount) ? '-': item.gain_amount.toFixed(2) %></td>
                    <td><%= isNaN(item.lose_count) ? '-': item.lose_count %></td>
                    <td><%= isNaN(item.lose_amount) ? '-': item.lose_amount.toFixed(2) %></td>
                    <td><%= isNaN(item.banker_person) ? '-': item.banker_person %></td>
                    <td><%= isNaN(item.banker_count) ? '-': item.banker_count %></td>
                    <td><%= isNaN(item.banker_bet) ? '-': item.banker_bet.toFixed(2) %></td>
                    <td><%= isNaN(item.banker_gain) ? '-': item.banker_gain.toFixed(2) %></td>
                    <td><%= isNaN(item.banker_system_gain) ? '-': item.banker_system_gain.toFixed(2) %></td>
            <% }) %>
        </tbody>
    </table>
</div>
</section>

